package io.dshubs.archives.task;

import io.dshubs.archives.dao.ArchiveHomeMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author tan 2021/9/2
 **/
@Slf4j
@Component
@EnableScheduling
public class ArchivesBorrowTimeOutTask {

    @Autowired
    private ArchiveHomeMapper archiveHomeMapper;

    @Scheduled(cron = "0 5 0 */1 * ?")
    public void run() {
        archiveHomeMapper.updateBorrowStatusNearTimeOut();
        archiveHomeMapper.updateBorrowStatusAlreadyTimeOut();
    }
}
